

//行号
var aaa=1;
var timea='';
$("#playbtn").on('click',function(){
	clearInterval(timea);
	getAllBlockColor();
	timea=setInterval(function(){
		unHighlightAllBlock();
		//var blocks = workspace.getAllBlocks();
		//blocks[aaa-1].svgPath_.setAttribute('fill','#006400');
		$(".blocklyDraggable .blocklyPath").eq(aaa-1).attr("fill",allblockcolor[aaa-1]);
		aaa++;
		console.log(aaa-1);
	},2000);
});
//暂停
$("#pausebtn").on('click',function(){
	clearInterval(timea);
});
//停止
$("#stopbtn").on('click',function(){
	clearInterval(timea);
	aaa=1;
	reductionAllBlockColor();
});
//获取所有的图形的颜色
var allblockcolor = new Array();
function getAllBlockColor(){
	var blocks = workspace.getAllBlocks();
	for(var i = 0; i < blocks.length; i++) {
		allblockcolor[i]=blocks[i].colour_;
		//console.log(allblockcolor);
	}
}
//运行时其它图形变灰色
function unHighlightAllBlock() {
	var blocks = workspace.getAllBlocks();
	for(var i = 0; i < blocks.length; i++) {
		blocks[i].svgPath_.setAttribute('fill','gray');
	}
}
//停止运行后恢复到原来颜色
function reductionAllBlockColor() {
	var blocks = workspace.getAllBlocks();
	for(var i = 0; i < blocks.length; i++) {
		blocks[i].svgPath_.setAttribute('fill',allblockcolor[i]);
		//console.log(blocks[i].colour_);
	}
}